package compiler.Exceptions;

@SuppressWarnings("serial")
public class OutOfLimitsException extends Exception
{
	public OutOfLimitsException(String string)
	{
		super("Variable \"" + unEscapeString(string) + "\" excedida de limites.");
	}
	
	public static String unEscapeString(String s){
	    StringBuilder sb = new StringBuilder();
	    for (int i=0; i<s.length(); i++)
	        switch (s.charAt(i)){
	            case '\n': sb.append("\\n"); break;
	            case '\t': sb.append("\\t"); break;
	            case '\r': sb.append("\\r"); break;
	            default: sb.append(s.charAt(i));
	        }
	    return sb.toString();
	}
}
